#include "taskbuttons.h"

#include <app_config.h>
#include <pubsub.h>

TaskButtons::TaskButtons() {
    this->log = LogUtil::getLogger("plugin-taskbuttons");
}

QString TaskButtons::pluginName() {
    return "taskbuttons";
}
QString TaskButtons::pluginVersion() {
    return AppConfig::getInstance()->appVersion();
}
QString TaskButtons::author() {
    return "janna";
}

QMap<QString, QVariant> TaskButtons::handler(const JannaTopic& topic, const QMap<QString, QVariant>& param) {
    if ("janna" == topic.source && "echo-taskbuttons" == topic.topic) {
        SPDLOG_LOGGER_DEBUG(this->log, fmt::format("plugin-taskbuttons ===> message is : {}",
                                                   param.value("msg").toString().toStdString()));
        QMap<QString, QVariant> publishParam;
        publishParam.insert("taskbuttons-count", 5);
        return publishParam;
    }
    return QMap<QString, QVariant>();
}
